package com.buddy.learn.javasource._thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author Buddy
 * @date 2021/5/12
 */
public class _ThreadPool {

    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 10,
                30, TimeUnit.MINUTES,
                new ArrayBlockingQueue<>(1024),
                r -> {
                    Thread t = new Thread(r);
                    t.setName("t");
                    return t;
                },
                new ThreadPoolExecutor.AbortPolicy());
        threadPoolExecutor.submit(() -> System.out.println(1));
    }
}
